package com.webchat.aigc.controller;

import com.webchat.aigc.llm.AbstractEmbeddingModel;
import com.webchat.aigc.llm.BasicEmbeddingModel;
import com.webchat.aigc.llm.EmbeddingModelFactory;
import com.webchat.common.bean.APIResponseBean;
import com.webchat.common.bean.APIResponseBeanUtil;
import com.webchat.rmi.aigc.BasicModelServiceClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class BasicModelServiceController implements BasicModelServiceClient {

    @Autowired
    private BasicEmbeddingModel embeddingModel;

    @Override
    public APIResponseBean<float[]> embed(String text) {

        return APIResponseBeanUtil.success(embeddingModel.embed(text));
    }

    @Override
    public APIResponseBean<List<float[]>> embed(List<String> texts) {

        return APIResponseBeanUtil.success(embeddingModel.embed(texts));
    }
}
